<?php

namespace Laoha\Core\Sets;

use Encore\Admin\Widgets\Form;

class Database extends Form
{
    /**
     * The form title.
     *
     * @var string
     */
    public $name = 'database';
	public $title = '数据库';    

    /**
     * Build a form here.
     */
    public function form()
    {
 		$this->data = require(config_path('sets/'.$this->name.'.php'));
		$this->action(admin_base_path('laoha/set').'?active='.$this->name);

		$this->text('path', '备份根路径')->rules('required')->help('路径必须以 / 结尾');
        $this->text('backup_size', '备份卷大小')->rules('required')->help('该值用于限制压缩后的分卷最大长度。单位：B；建议设置20M');
        $this->radio('zip', '备份是否压缩')->options([1 => '是', 0 => '否'])->help('压缩备份文件需要PHP环境支持 gzopen, gzwrite函数');
        $this->radio('zip_level', '备份压缩级别')->options([1 => '最低', 2 => '一般', 3 => '最高'])->help('数据库备份文件的压缩级别，该配置在开启压缩时生效');
    }

}
